export default Array.prototype.myReduce = function (cb, initalValul) {
    if (typeof cb !== 'function') {
        throw TypeError('cb is must be a function !')
    }
    let array = this
    let pre = initalValul ? initalValul : (array.length ? array[0] : [])
    for (let i = initalValul ? 0 : 1; i < array.length; i++) {
        pre = cb(pre, array[i], i, array)
    }
    return pre
}